#include "Base\stdafx.h"

#include "CharacterTest.h"

#include "Scenegraph/GameObject.h"
#include "Components/ModelComponent.h"
#include "../../Materials/ColorMaterial.h"
#include "../../Materials/DiffuseMaterial.h"
#include "Components/Components.h"
#include "Content/ContentManager.h"
#include "Physx/PhysxManager.h"
#include "Components/TransformComponent.h"
#include "Physx\PhysxProxy.h"


CharacterTest::CharacterTest(void) :
GameScene(L"CharacterTest"),
m_pPlayer(nullptr)
{
}


CharacterTest::~CharacterTest(void)
{
}

void CharacterTest::Initialize(const GameContext& gameContext)
{
	UNREFERENCED_PARAMETER(gameContext);

	GetPhysxProxy()->EnablePhysxDebugRendering(true);

	//GROUND PLANE
	//************
	auto physX = PhysxManager::GetInstance()->GetPhysics();

	auto bouncyMaterial = physX->createMaterial(0, 0, 1);
	auto ground = new GameObject();
	ground->AddComponent(new RigidBodyComponent(true));

	std::shared_ptr<PxGeometry> geom(new PxPlaneGeometry());
	ground->AddComponent(new ColliderComponent(geom, *bouncyMaterial, PxTransform(PxQuat(XM_PIDIV2, PxVec3(0, 0, 1)))));
	AddChild(ground);

	//CCONTROLLER OBJECT
	//******************
	m_pPlayer = new Character();
	m_pPlayer->GetTransform()->Translate(0, 50, 0);
	AddChild(m_pPlayer);



}

void CharacterTest::Update(const GameContext& gameContext)
{
	UNREFERENCED_PARAMETER(gameContext);
	m_pPlayer->Update( gameContext );
}

void CharacterTest::Draw(const GameContext& gameContext)
{
	UNREFERENCED_PARAMETER(gameContext);
}

